﻿using AdvVerifyModels.Models.Requests.Stage;
using Microsoft.Extensions.DependencyInjection;
using Refit;

namespace TestStageServiceDemo
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            // 设置API基本地址（根据实际环境修改）
            const string baseAddress = "http://127.0.0.1:5124";

            // 配置依赖注入
            var services = new ServiceCollection();

            services.AddRefitClient<IStageApi>()
                .ConfigureHttpClient(c => c.BaseAddress = new Uri(baseAddress));

            var serviceProvider = services.BuildServiceProvider();

            // 获取接口实例
            var stageApi = serviceProvider.GetRequiredService<IStageApi>();

            try
            {
                // 示例：测试Lease方法
                var leaseResult = await stageApi.Lease(new LeaseRequest(Guid.NewGuid().ToString(),10_000));
                Console.WriteLine($"Lease成功: {leaseResult}");

                //// 示例：测试Move方法
                //await stageApi.Move(123, 10.5, 20.3);
                //Console.WriteLine("Move命令已发送");

                //// 示例：测试Release方法
                //await stageApi.Release(456);
                //Console.WriteLine("Release操作完成");

                // 添加其他方法测试...
            }
            catch (ApiException ex)
            {
                Console.WriteLine($"API错误: {ex.StatusCode} - {ex.Message}");
            }
        }
    }
}
